//
//  CinemaTableViewCell.m
//  UI14_HomeWork_豆瓣
//
//  Created by Bodi on 16/6/25.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CinemaTableViewCell.h"
#import "CinemaModel.h"
#define kWidth self.contentView.frame.size.width
#define kHight self.contentView.frame.size.height
@interface CinemaTableViewCell ()
@property (nonatomic, retain)UILabel *nameLabel;
@property (nonatomic, retain)UILabel *addressLabel;
@property (nonatomic, retain)UILabel *teleLabel;



@end



@implementation CinemaTableViewCell
- (void)dealloc{
    [_nameLabel release];
    [_addressLabel release];
    [_teleLabel release];
    [super dealloc];

}
//- (instancetype)initWithFrame:(CGRect)frame {
//    self = [super initWithFrame:frame];
//    if (self) {
//
//        self.nameLabel = [[UILabel alloc]init];
//        [self.contentView addSubview:_nameLabel];
//        [_nameLabel release];
//        self.addressLabel = [[UILabel alloc]init];
//        [self.contentView addSubview:_addressLabel];
//        [_addressLabel release];
//        self.teleLabel = [[UILabel alloc]init];
//        [self.contentView addSubview:_teleLabel];
//        [_teleLabel release];
//    }
//    return self;
//
//
//}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.nameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel release];
        self.addressLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_addressLabel];
        [_addressLabel release];
        self.teleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_teleLabel];
        [_teleLabel release];
    }
    return self;



}
- (void)layoutSubviews{
    [super layoutSubviews];
    UIImage *image = [UIImage imageNamed:@"bg_eventlistcell"];
    UIImageView *view = [[UIImageView alloc]initWithImage:image];
    view.frame = CGRectMake(20, 0, kWidth - 40, kHight - 30);
    [self.contentView addSubview:view];
    
    
    self.nameLabel.frame = CGRectMake(40, 20, 400, 40);
//    self.nameLabel.backgroundColor = [UIColor orangeColor];
    self.nameLabel.font = [UIFont systemFontOfSize:25.0f];
    [self.contentView addSubview:self.nameLabel];
    
    self.addressLabel.frame = CGRectMake(40, 40, 300, 80);
    self.addressLabel.numberOfLines = 2;
//    self.addressLabel.backgroundColor =[UIColor greenColor];
    self.addressLabel.font = [UIFont systemFontOfSize:18.0f];
    [self.contentView addSubview:self.addressLabel];
    
    self.teleLabel.frame = CGRectMake(40, 100, 400, 30);
//    self.teleLabel.backgroundColor = [UIColor cyanColor];
    self.teleLabel.font =[UIFont systemFontOfSize:15.0f];
    [self.contentView addSubview:self.teleLabel];




}

- (void)setModel:(CinemaModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    _nameLabel.text = model.cinemaName;
    _addressLabel.text = model.address;
    _teleLabel.text = model.telephone;


}

@end
